﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace LevelEditor.model.elements
{
    public class Picture
    {
        #region Variables
        private string m_url;
        private float m_pictureSizeX;
        private float m_pictureSizeY;
        private Bitmap m_picture;

        #endregion

        #region Constructeurs
        public Picture(string url, float pictureSizeX, float pictureSizeY)
        {
            m_url = url;
            m_pictureSizeX = pictureSizeX;
            m_pictureSizeY = pictureSizeY;

            PictureBox picBox = new PictureBox();
            picBox.Image = Image.FromFile(m_url);
            m_picture = new Bitmap(Convert.ToInt32(m_pictureSizeX), Convert.ToInt32(m_pictureSizeY));
            picBox.DrawToBitmap(m_picture, new Rectangle(0, 0, Convert.ToInt32(m_pictureSizeX), Convert.ToInt32(m_pictureSizeY)));
        }

        #endregion

        #region Getters && Setters
        public string url
        {
            get { return m_url; }
            set { m_url = value; }
        }

        public float pictureSizeX
        {
            get { return m_pictureSizeX; }
            set { m_pictureSizeX = value; }
        }

        public float pictureSizeY
        {
            get { return m_pictureSizeY; }
            set { m_pictureSizeY = value; }
        }

        public Bitmap picture
        {
            get { return m_picture; }
            set { m_picture = value; }
        }

        #endregion
    }
}
